using MESBaseis.Domain.BaseEntities;

namespace MESBaseis.Domain.ZSHH
{
    /// <summary>
    /// 生产计划主表
    /// </summary>
    public class ProductionPlan : BaseModel
    {
        /// <summary>
        /// 计划单号 (如: PD-2024-001)
        /// </summary>
        public string PlanNumber { get; set; } = string.Empty;

        /// <summary>
        /// 计划主题
        /// </summary>
        public string PlanSubject { get; set; } = string.Empty;

        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime DocumentDate { get; set; }

        /// <summary>
        /// 关联销售订单ID (可为空)
        /// </summary>
        public int? SalesOrderId { get; set; }

        /// <summary>
        /// 关联项目ID
        /// </summary>
        public int? ProjectId { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 计划状态 (草稿、已确认、执行中、已完成、已取消)
        /// </summary>
        public string Status { get; set; } = "草稿";

        /// <summary>
        /// 是否绑定销售订单
        /// </summary>
        public bool IsBindSalesOrder { get; set; } = true;

        // 导航属性
        public virtual SalesOrder? SalesOrder { get; set; }
        public virtual Project? Project { get; set; }
        public virtual ICollection<ProductionPlanItem> ProductionPlanItems { get; set; } = new List<ProductionPlanItem>();
        public virtual ICollection<ProductionPlanAttachment> Attachments { get; set; } = new List<ProductionPlanAttachment>();
        public virtual ICollection<ProductionPlanOperationLog> OperationLogs { get; set; } = new List<ProductionPlanOperationLog>();
    }
}